package KUtilities;

import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class KLogger extends JScrollPane {
	private static final long serialVersionUID = 1L;
	private JTextArea logger;
	
	public KLogger(){
		logger=new JTextArea();
		logger.setEditable(false);
		logger.setWrapStyleWord(true);
		logger.setLineWrap(true);
		this.setViewportView(logger);
		setAutoscrolls(true);
	}
	
	public void log(String logText){
		logger.append(logText+"\n");
		logger.setCaretPosition(logger.getDocument().getLength()-1);
	}
	
	public JTextArea getLogger(){
		return logger;
	}
}
